/*LH 28-12-2021; La función checkApellidos(e) nos permite validar el campo Apellidos, que solo permitan ingresar el patron de entrada*/ function checkApellidos(e) { //Tecla de retroceso para borrar, siempre la permite tecla = (document.all) ? e.keyCode : e.which; if (tecla == 8) { return true; } // Patron de entrada, en este caso solo acepta los carecteres [A-ZÁÉÍÓÚÑÜËa-záéíóúñüë'.`´, -] //patron = /^$|[A-ZÁÉÍÓÚÑÜa-záéíóúñü'' ]/; patron = /^$|[A-ZÁÉÍÓÚÑÜËa-záéíóúñüë'.`´, -]/; tecla_final = String.fromCharCode(tecla); return patron.test(tecla_final); } /*LH 28-12-2021; La función checkIdentificacion(e) nos permite validar el campo Apellidos, que solo permitan ingresar el patron de entrada*/ function checkIdentificacion(e) { //Tecla de retroceso para borrar, siempre la permite tecla = (document.all) ? e.keyCode : e.which; if (tecla == 8) { return true; } // Patron de entrada, en este caso solo acepta los carecteres [A-Za-z0-9-/] patron = /^$|[A-Za-z0-9-/]/; tecla_final = String.fromCharCode(tecla); return patron.test(tecla_final); } function isNumber(n) { return !isNaN(parseFloat(n)) && isFinite(n); } function habilitaBoton (boton, text) { if (boton == "apellidos") { document.getElementById('formPrincipal:identificacion').value = ""; if(document.getElementById('formPrincipal:apellidos').value == ""){ document.getElementById('formPrincipal:boton-buscar').disabled=true; }else{ document.getElementById('formPrincipal:boton-buscar').disabled=false; } } else { document.getElementById('formPrincipal:apellidos').value = ""; if(document.getElementById('formPrincipal:identificacion').value == ""){ document.getElementById('formPrincipal:boton-buscar').disabled=true; }else{ document.getElementById('formPrincipal:boton-buscar').disabled=false; } } } window.onload = function() { var apellidos = document.getElementById('formPrincipal:apellidos'); var identificacion = document.getElementById('formPrincipal:identificacion'); if (apellidos != null && identificacion !=null){ if(document.getElementById('formPrincipal:apellidos').value == "" && document.getElementById('formPrincipal:identificacion').value == ""){ document.getElementById('formPrincipal:boton-buscar').disabled=true; }else { document.getElementById('formPrincipal:boton-buscar').disabled=false; } } // Comertar cuando se pase a pre producción (1) y (2) y descomentar para producción /*(1)LH 28-12-2021; La función [copy paste] permite inhabilitar la acción de pegar y copiar en los campos apellidos, identificacion*/ $('body').on('copy paste', 'input', function (e) { e.preventDefault(); }); /*(2)LH 29-12-2021; La función [oncontextmenu] permite inhabilitar la acción del clic derecho del mouse*/ document.oncontextmenu = function(){return false} //document.getElementById('formPrincipal:boton-buscar').disabled=true; /*if($("#identificacion").val() != "") { $("#buscar-identificacion").removeAttr("disabled"); } else if ($("#apellidos").val() != "") { $("#buscar-apellidos").removeAttr("disabled"); }*/ }; $(document).ready(function() { $("#buscadorApellidos").keypress(function(e) { if (e.which == 13) { return false; } }); /*LH 11-01-2021; Se deshabilitar este atributo [autocomplete] en el formulario con la finalidad que el navegador no permita predecir valores anteriormente ingresados*/ $("form").attr('autocomplete', 'off'); }); function limpiaForm(){ document.getElementById("idTipoDocumento").value="-1"; } function disableCtrlKey(e) { var code = (document.all) ? event.keyCode:e.which; // look for CTRL key press if (parseInt(code)==17) { alert("Por digite los n\u00FAmeros, no se permite copiar y pegar"); window.event.returnValue = false; } window.addEventListener("keypress", function(event){ if (event.keyCode == 13){ event.preventDefault(); } }, false); } function disableRightClick(event) { //For mouse right click if (event.button==2 || event.button== 3) { alert("Por digite los n\u00FAmeros, no se permite copiar y pegar"); } window.addEventListener("keypress", function(event){ if (event.keyCode == 13){ event.preventDefault(); } }, false); } function validateAlphaNumeric(evt) { keynum = (document.all) ? evt.keyCode : evt.which; // ESPACIO=32 // BORRAR=8 // ENTER=13 // alert("keynum " + keynum); if ((keynum > 47 && keynum < 58) || (keynum >= 65 && keynum <= 90) || (keynum >= 97 && keynum <= 122) || keynum == 8 || keynum == 13 || keynum == 9 || keynum == 46 || keynum == 45) { return true; } else { return false; } } function validateNumeric(evt) { keynum = (document.all) ? evt.keyCode : evt.which; // ESPACIO=32 // BORRAR=8 // ENTER=13 //alert("keynum " + keynum); if ((keynum > 47 && keynum < 58) || keynum == 8 || keynum == 13 || keynum == 9 || keynum == 46) { return true; } else { return false; } } function submitForm() { var frm = document.getElementsByName('frmInfoConsulta')[0]; frm.reset(); // Reset } function alerta(){ alert("Que pasaaaaa"); }